<?php include_once($_SERVER['DOCUMENT_ROOT']."/controller/common/common_setting_unit.php");// 引入通用的设置文件 ?>
<?php include_once($_SERVER['DOCUMENT_ROOT']."/controller/common/module/head.php"); // 引入通用的头部 ?>
<?php include_once("../controller/category_add.php");// 当前页面的控制器 ?>
<?php include_once("module/mod-nkeditor.php");// 富文本编辑框 ?>

<body>

<!--顶部栏-->
<div id="topbar"> <?php include $_SERVER['DOCUMENT_ROOT'] . '/controller/common/module/topbar.php'; ?></div>

<!--容器-->
<div id="container" class="<?php echo $now_extender ?>">

    <!--侧边栏-->
    <div id="sidebar"><?php include $_SERVER['DOCUMENT_ROOT'] . '/controller/common/module/sidebar.php'; ?></div>





    <?php
    //==============================================================================
    //这里开始才是平常开发需要注重的部分，其余的基本不用理会
    //==============================================================================
    ?>



        <div id="content">

            <!--标题设定-->
            <?php $page_title='添加分类';?>
            <?php include $_SERVER['DOCUMENT_ROOT'].'/controller/common/module/mod-page-title.php'; ?>
            <?//============================================?>
            <?//以下开发需要注重的部分，主要写前端?>
            <?//============================================?>



            <div class="detail-box">



                <ul>
                    <form method="post" class="layui-form"
                          action ="category_add_process.php?<? echo $data['url_parameter'] ?>"
                          enctype="multipart/form-data">


                        <input type="hidden"  name="nid" value="<? echo $data['data_detail']['nid']?>" >


                        <li class="layui-form-item name">
                            <label class="layui-form-label">分类名称：</label>
                            <div class="layui-input-block"><input type="text" class="layui-input"  name="ai_name" size="20" value="">
                                <em class="explain">(<u style="color:red">*必填项目</u>,填写本分类的标题)</em>
                            </div>
                        </li>





                        <li class="layui-form-item term"><label class="layui-form-label">所属分类：</label>

                            <div class="layui-input-block">

                                <select name="ai_parent_nid">


                                    <option value="root" selected="selected">当前所属分类:根目录 \</option>
                                    <?foreach ($category as $val)
                                    {
                                        echo '<option value="'.$val['nid'].'">'.$val['name'].'</option>';

                                        foreach ($val['level2'] as $val2)
                                        {
                                            echo '<option value="'.$val2['nid'].'">'.$val['name']. ' > '.$val2['name'].'</option>';
                                        }
                                    }?>

                                </select>
                                <em class="explain">(选择本分类对应的上级分类，如是一级分类，请选择“根目录”)</em>
                            </div>
                        </li>





                        <!--普通的textarea多行文本输入-->
                        <li class="layui-form-item introduce">
                            <label class="layui-form-label">简介：</label>
                            <div class="layui-input-block">
                                <textarea class="layui-textarea" name="ai_introduce"  ><?echo  $data['data_detail']['introduce']?></textarea>
                                <em class="explain">(填写本文的概述)</em>
                            </div>
                        </li>

                        <!--异步上传：选择图片时候已经处理好文件上传-->
                        <li class="layui-form-item icon">
                            <label class="layui-form-label">小图：</label>
                            <div class="layui-input-block">
                                <? include("module/mod-icon-async-upload.php");?>
                            </div>
                        </li>


                        <div class="layui-form-item">
                            <label class="layui-form-label">标签</label>
                            <div class="layui-input-block" >
                                <? foreach ($tag_array as $k => $v){?>
                                    <input type="checkbox" name="ai_tag[]"  value="<?echo $v?>"     title="<?echo $v?>"
                                       >
                                    <?;}?>
                            </div>

                        </div>



                        <!--富文本编辑框-->
                        <li class="layui-form-item detail">
                            <label class="layui-form-label">资料详情：</label>
                            <div class="layui-input-block">
                                <textarea name="ai_content" style="width:1000px;height:400px;visibility:hidden;"><? echo $data['data_detail']['detail'] ?></textarea>
                                <em class="explain">(填写详细页面文字、图片等主体内容)</em>
                            </div>
                        </li>



                        <li class="layui-form-item listorder">
                            <label class="layui-form-label">列表排序：</label>
                            <div class="layui-input-block">
                                <input type="text" class="layui-input"  name="ai_listorder" lay-verify="number" value="0">
                                <em class="explain">(填写本分类在所属前台列表下的列表排序，数字越大，排序越靠前)</em>
                            </div>
                        </li>








                        <!--单选项-->
                        <li class="layui-form-item publish_status">
                            <label class="layui-form-label">发布状态：</label>
                            <div class="layui-input-block">
                                <input name='ai_publish_status' type='radio' value='发布' title="立即发布" checked />
                                <input name='ai_publish_status' type='radio' value='隐藏' title="暂未发布" />
                                <br class="clearfloat" />
                                <em class="notice">(选择立即发布，以上信息才能在前台显示；选择暂未发布，只对以上信息进行保存，不在前台显示)</em>
                            </div>
                        </li>




                        <!--时间选择-->
                        <li class="layui-form-item">
                            <label class="layui-form-label">发布时间：</label>
                            <div class="layui-input-block">
                                <input type="text" class="laydate-icon laydate_time layui-input"
                                       name="ai_publish_date" required
                                       value="<? echo date("Y-m-d H:i:s"); ?>"
                                >
                                <em class="explain">(填写发布的时间)</em>
                            </div>
                        </li>







                        <div class="function">
                            <button class="layui-btn"  lay-submit type="submit" >立即提交</button>

                            <input type="reset" class="layui-btn" value="重置"/>
                        </div>



                    </form>
                </ul>

            </div>




        </div>



        <?
        //==============================================================================
        //这里上面才是平常开发需要注重的部分，下面的基本不用理会，只有底部JS部分需要根据实际情况去加载
        //==============================================================================
        ?>




</div>
<!--content端點01-->
<?
//==============================================================================
//这里上面才是平常开发需要注重的部分，下面的基本不用理会，只有底部JS部分需要根据实际情况去加载
//==============================================================================
?>





<br class="clearfloat"/>
<!--container-->
</div>


<!--底部栏-->
<?php include $_SERVER['DOCUMENT_ROOT']."/controller/common/module/footer.php"; ?>


</body>
</html>












